import './globals.css';
import type { Metadata, Viewport } from 'next';
import { Providers } from '@/lib/providers';
import Navbar from '@/components/ui/navbar';
import MobileNavbar from '@/components/ui/mobile-navbar';
import { Toaster } from '@/components/ui/toaster';
import { inter } from '@/lib/fonts';

// 明确定义metadata对象，避免序列化问题
export const metadata: Metadata = {
  title: 'NextCollab - 协作平台',
  description: '基于Next.js的团队协作平台',
  icons: {
    icon: '/favicon.ico',
  },
};

// 单独导出viewport配置
export const viewport: Viewport = {
  width: 'device-width',
  initialScale: 1,
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="zh-CN" suppressHydrationWarning>
      <body className={inter.className}>
        <Providers>
          <div className="flex flex-col min-h-screen">
            <Navbar />
            <div className="flex-grow">
              {children}
            </div>
            <MobileNavbar />
          </div>
          <Toaster />
        </Providers>
      </body>
    </html>
  );
}
